package com.example.administrator.nl.activity.register;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.administrator.nl.R;
import com.example.administrator.nl.activity.RegisterActivity;
import com.example.administrator.nl.base.BaseActivity;
import com.leaf.library.StatusBarUtil;
import com.makeramen.roundedimageview.RoundedImageView;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 注册用户类型
 * @author yuan
 */
public class RegisterTypeActivity extends BaseActivity {

    // 返回按钮
    @BindView(R.id.iv_finish)
    ImageView ivFinish;

    // 页面标题
    @BindView(R.id.tv_title)
    TextView tvTitle;

    @BindView(R.id.rl)
    RelativeLayout rl;

    // 注册用户
    @BindView(R.id.tv_register_user_register)
    TextView tvRegisterUserRegister;
    @BindView(R.id.riv_register_user_register)
    RoundedImageView riv_register_user_register;

    // 注册店家
    @BindView(R.id.tv_register_business_register)
    TextView tvRegisterBusinessRegister;
    @BindView(R.id.riv_register_business_register)
    RoundedImageView riv_register_business_register;

    // 注册合伙人
    @BindView(R.id.tv_register_partner_register)
    TextView tvRegisterPartnerRegister;
    @BindView(R.id.riv_register_partner_register)
    RoundedImageView riv_register_partner_register;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void init() {
        // 设置状态颜色
        StatusBarUtil.setColor(RegisterTypeActivity.this, getResources().getColor(R.color.color_white_ffffff));
        tvTitle.setText("注册");
    }

    @Override
    public int getContentView() {
        return R.layout.activity_register_type_acivity;
    }

    @OnClick({R.id.tv_register_user_register, R.id.tv_register_business_register, R.id.tv_register_partner_register})
    public void onViewClicked(View view) {
        Intent intent;
        switch (view.getId()) {
            // 进入注册用户页面
            case R.id.tv_register_user_register:
            case R.id.riv_register_user_register:
                intent = new Intent(RegisterTypeActivity.this, RegisterActivity.class);
                startActivity(intent);
                break;

            // 进入注册店家页面
            case R.id.tv_register_business_register:
            case R.id.riv_register_business_register:
                intent = new Intent(RegisterTypeActivity.this, RegisterBusinessOrPartnerActivity.class);
                // 1 注册商家
                intent.putExtra("type", "1");
                startActivity(intent);
                break;

            // 进入注册合伙人页面
            case R.id.tv_register_partner_register:
            case R.id.riv_register_partner_register:
                intent = new Intent(RegisterTypeActivity.this, RegisterBusinessOrPartnerActivity.class);
                // 注册合伙人
                intent.putExtra("type", "2");
                startActivity(intent);
                break;

            // 返回按钮
            case R.id.iv_finish:
                finish();
                break;
            default:
                break;
        }
    }
}
